﻿using System;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000166 RID: 358
	[Serializable]
	public class IKMappingBone : IKMapping
	{
		// Token: 0x06000630 RID: 1584 RVA: 0x0001DD9E File Offset: 0x0001C19E
		public IKMappingBone()
		{
		}

		// Token: 0x06000631 RID: 1585 RVA: 0x0001DDBC File Offset: 0x0001C1BC
		public IKMappingBone(Transform bone)
		{
			this.bone = bone;
		}

		// Token: 0x06000632 RID: 1586 RVA: 0x0001DDE1 File Offset: 0x0001C1E1
		public override bool IsValid(IKSolver solver, ref string message)
		{
			if (!base.IsValid(solver, ref message))
			{
				return false;
			}
			if (this.bone == null)
			{
				message = "IKMappingBone's bone is null.";
				return false;
			}
			return true;
		}

		// Token: 0x06000633 RID: 1587 RVA: 0x0001DE0D File Offset: 0x0001C20D
		public void StoreDefaultLocalState()
		{
			this.boneMap.StoreDefaultLocalState();
		}

		// Token: 0x06000634 RID: 1588 RVA: 0x0001DE1A File Offset: 0x0001C21A
		public void FixTransforms()
		{
			this.boneMap.FixTransform(false);
		}

		// Token: 0x06000635 RID: 1589 RVA: 0x0001DE28 File Offset: 0x0001C228
		public override void Initiate(IKSolverFullBody solver)
		{
			if (this.boneMap == null)
			{
				this.boneMap = new IKMapping.BoneMap();
			}
			this.boneMap.Initiate(this.bone, solver);
		}

		// Token: 0x06000636 RID: 1590 RVA: 0x0001DE52 File Offset: 0x0001C252
		public void ReadPose()
		{
			this.boneMap.MaintainRotation();
		}

		// Token: 0x06000637 RID: 1591 RVA: 0x0001DE5F File Offset: 0x0001C25F
		public void WritePose(float solverWeight)
		{
			this.boneMap.RotateToMaintain(solverWeight * this.maintainRotationWeight);
		}

		// Token: 0x04000368 RID: 872
		public Transform bone;

		// Token: 0x04000369 RID: 873
		[Range(0f, 1f)]
		public float maintainRotationWeight = 1f;

		// Token: 0x0400036A RID: 874
		private IKMapping.BoneMap boneMap = new IKMapping.BoneMap();
	}
}
